package com.wei.czz.config;

import com.wei.czz.common.property.MinioProperty;
import io.minio.MinioClient;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * Created by IntelliJ IDEA.
 *
 * @author wyw
 * date: 2025-03-22 14:16:03
 * className: MinioConfig
 * version: 1.0
 * description:
 */
@Configuration
public class MinioConfig {

    /**
     * 注入minio客户端
     *
     * @param minioProperty minio属性
     * @return {@link MinioClient}
     */
    @Bean
    public MinioClient minioClient(MinioProperty minioProperty) {
        return MinioClient.builder()
                .endpoint(minioProperty.getEndpoint())
                .credentials(minioProperty.getAccessKey(), minioProperty.getSecretKey())
                .build();
    }
}
